package 创建者模式.原型模式.深克隆;

import java.io.*;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
        Citation citation=new Citation();
        //创建张三学生对象
        Student stu=new Student();
        stu.setName("张三");
        citation.setStu(stu);

        //创建对象输出流对象
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("C:/Users/陈洋/Desktop/新建文本文档.txt"));
        oos.writeObject(citation);
        //释放资源
        oos.close();

        //读取对象输入流对象
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("C:/Users/陈洋/Desktop/新建文本文档.txt"));
        Citation citation1= (Citation) ois.readObject();
        //释放资源
        ois.close();

        Student stu1=citation1.getStu();
        stu1.setName("李四");

        citation.show();
        citation1.show();
    }
}
